#include <iostream>
#include <vector>
using namespace std;


#define SQR(A) A*A
void test1(){
    int x = 6, y = 3, z = 2;
    x /= SQR(y+z)/SQR(y+z);
    std::cout << x;
}

void test2(){
    int i = 1;
    if (i <= 0)
        printf("**\n") ;
    else
        printf("%%\n");
}

struct A{
    long a1;
    short a2;
    int a3;
    int *a4;
};

void test3(){
    std::cout << sizeof(struct A);
}

void Test1(){
    int n, m;
    cin >> n >> m;
    vector<vector<int>> arr;
    arr.resize(n);
    for (auto & i : arr) {
        i.resize(m,1);
    }
    int count = 0;
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) {
            if (arr[i][j] == 1){
                ++count;
                if (i + 2 < n)
                    arr[i+2][j] = 0;
                if (j + 2 < m)
                    arr[i][j+2] = 0;
            }
        }
    }
    cout << count << endl;
}

class Solution{
public:
    int StrToInt(string str){
        int index = 0, flag = 1, len = str.size();
        long long result = 0;
        while (str[index] == ' ')
            ++index;
        if (str[index] == '-' || str[index] == '+'){
            if (str[index] == '-')
                flag = -1;
            ++index;
        }
        while (index < len && isdigit(str[index])){
            result = result * 10 + (str[index] - '0');
            if (result >= INT_MAX && flag == 1)
                return INT_MAX;
            if (result > INT_MAX && flag == -1)
                return INT_MIN;
            ++index;
        }
        if (index == len)
            return flag * result;
        else
            return 0;
    }
};

int main() {
    //test3();
    //Test1();
    cout << Solution().StrToInt("    -1232433");
    return 0;
}
